<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>

<div id="pieDiv" style="width: 700px;height: 600px;"></div>
<script src="/public/libs/jquery.min.js"></script>
<script src="/public/plugins/echarts/echarts.min.js"></script>
<script type="text/javascript">
    $(function(){
        // based on prepared DOM, initialize echarts instance
        var myChart = echarts.init(document.getElementById('pieDiv'));

        option = {
            title: {
                text: '千锋',
                subtext: '真实内部数据',
                left: 'center'
            },
            tooltip: {
                trigger: 'item',
                formatter: '{a} <br/>{b} : {c} ({d}%)'
            },
            legend: {
                orient: 'vertical',
                left: 'left',
                data: ['直接访问', '邮件营销', '联盟广告', '视频广告', '搜索引擎']
            },
            series: [
                {
                    name: '访问来源',
                    type: 'pie',
                    radius: '55%',
                    center: ['50%', '60%'],
                    data: [
                        ],
                    emphasis: {
                        itemStyle: {
                            shadowBlur: 10,
                            shadowOffsetX: 0,
                            shadowColor: 'rgba(0, 0, 0, 0.5)'
                        }
                    }
                }
            ]
        };


        // //异步请求  获取数据
        $.get("/sys/echarts/pie",function(r){
            option.series[0].data = r;
            console.log(option.series[0].data);
            // use configuration item and data specified to show chart
            myChart.setOption(option);

        });


        myChart.setOption(option);
    });
</script>
</body>
</html>